import java.util.ArrayList;

import model.Shape;
import model.Stop;
import model.SubRota;
import dao.DaoAgente;


public class TesteDao {
	
	
	public  static void teste(){
		
		DaoAgente dao = new DaoAgente();
		ArrayList<Stop> stops = new ArrayList<Stop>();
		ArrayList<String> trips = new ArrayList<String>();
		ArrayList<Shape> shapes = new ArrayList<Shape>();
		SubRota srt = new SubRota(); 
		
		
		

		stops = dao.getStopsOfTrips("475M-10-1");
		System.out.println("\n");		
		System.out.println("==========================STOPS DE UMA VIAGEM============================");
		for(int i=0; i < stops.size(); i++){
			System.out.println(stops.get(i).getStop_id()+"|"+stops.get(i).getStop_lat()+"|"+stops.get(i).getStop_lon()+"|"+stops.get(i).getStop_name()+"|"+stops.get(i).getStop_desc()+"|"+stops.get(i).getStop_sequence());
		}
		
		//getStopOfTripStopId
		Stop stp = new Stop();
		stp = dao.getStopOfTripStopId("475M-10-1", 920010990);
		System.out.println("\n");		
		System.out.println("==========================STOP ESPECIFICO DE UMA VIAGEM============================");
		System.out.println(stp.getStop_id()+"|"+stp.getStop_lat()+"|"+stp.getStop_lon()+"|"+stp.getStop_name()+"|"+stp.getStop_desc()+"|"+stp.getStop_sequence());
		
		
		
		stops = dao.getStopsOfTrips("475M-10-1", 20, 30);
		System.out.println("\n");		
		System.out.println("================STOPS DE UMA VIAGEM ENTRE DOIS PONTOS (STOPS)===============");
		for(int i=0; i < stops.size(); i++){
			System.out.println(stops.get(i).getStop_id()+"|"+stops.get(i).getStop_lat()+"|"+stops.get(i).getStop_lon()+"|"+stops.get(i).getStop_name()+"|"+stops.get(i).getStop_desc()+"|"+stops.get(i).getStop_sequence());
		}
		
		
		
		//getStopsOfCoordRaio
		stops = dao.getStopsOfCoordRaio(-23.600061, -46.550996, 1);
		System.out.println("\n");		
		System.out.println("==========================STOPS EM MUM RAIO============================");
		for(int i=0; i < stops.size(); i++){
			System.out.println(stops.get(i).getStop_id()+"|"+stops.get(i).getStop_lat()+"|"+stops.get(i).getStop_lon()+"|"+stops.get(i).getStop_name()+"|"+stops.get(i).getStop_desc()+"|"+stops.get(i).getStop_sequence());
		}
		
		
		//getStopsOfCoordRaio
		stops = dao.getStopsOfCoordRaio("475M-10-1", -23.609961, -46.621805, 100);
		System.out.println("\n");		
		System.out.println("==========================STOPS EM MUM RAIO PASSANDO A LINHA============================");
		for(int i=0; i < stops.size(); i++){
			System.out.println(stops.get(i).getStop_id()+"|"+stops.get(i).getStop_lat()+"|"+stops.get(i).getStop_lon()+"|"+stops.get(i).getStop_name()+"|"+stops.get(i).getStop_desc()+"|"+stops.get(i).getStop_sequence());
		}

		
		//getTripsOfStopCoordRaio
		trips = dao.getTripsOfStopCoordRaio(700015914, -23.609961, -46.621805, 1);
		
		System.out.println("\n");
		System.out.println("=========================TRIPS BUSCA EM UM PONTO E NO RAIO DE DESTINO=============================");
		for(int i=0; i < trips.size(); i++){
			System.out.println("Linha: "+trips.get(i));
		}
		
		
		
		//getShapesOfTripCoordRaio
		shapes = dao.getShapesOfTripCoordRaio("475M-10-1", -23.538842, -46.647929, 2);
		
		System.out.println("\n");
		System.out.println("=========================BUSCA SHAPES RAIO 30M=============================");
		for(int i=0; i < shapes.size(); i++){
			System.out.println(shapes.get(i).getShape_id()+"|"+shapes.get(i).getShape_pt_lat()+"|"+shapes.get(i).getShape_pt_lon()+"|"+shapes.get(i).getShape_pt_sequence()+"|"+shapes.get(i).getShape_dist_traveled());
		}
		
		
		
		//getShapesOfTripCoordRaio
		shapes = dao.getShapesOfTripOrigemDestino(23852, 100, 200);
		
		System.out.println("\n");
		System.out.println("=========================BUSCA TODOS OS SHAPES ENTRE ORIGEM E DESTINO ENCONTRADO=============================");
		for(int i=0; i < shapes.size(); i++){
			System.out.println(shapes.get(i).getShape_id()+"|"+shapes.get(i).getShape_pt_lat()+"|"+shapes.get(i).getShape_pt_lon()+"|"+shapes.get(i).getShape_pt_sequence()+"|"+shapes.get(i).getShape_dist_traveled());
		}
		
		
		
		
		
		//preencheSubrota
		srt = dao.preencheSubrota("475M-10-1", srt);
		srt.setForma(shapes);
		srt.setStopOrigem(stops.get(0));
		srt.setStopDestino(stops.get(stops.size()-1));
		
		System.out.println("\n");
		System.out.println("=========================UMPRIMINDO DADOS DA SUBROTA=============================");
		for(int i = 0; i< srt.getForma().size(); i++){
			System.out.print(" - Id: "+srt.getForma().get(i).getShape_id());
		}
		System.out.println("Stop de origem ID: "+srt.getStopOrigem().getStop_id());
		System.out.println("Stop de destino ID: "+srt.getStopDestino().getStop_id());
		System.out.println("Origem LAT: "+srt.getOrigem().getLat()+"\t\t\tOrigem LON: "+srt.getOrigem().getLon());
		System.out.println("Destino LAT: "+srt.getDestino().getLat()+"\t\t\tDestino LON: "+srt.getDestino().getLon());
		System.out.println("Distancia: "+srt.getDistancia());
		System.out.println("Viagem: "+srt.getViagem());
		System.out.println("Linha: "+srt.getLinha());
		System.out.println("Descrição: "+srt.getDescricaoLong());
		System.out.println("Tipo: "+srt.getTipo());
		System.out.printf("Tarifa: R$ %.2f\n",srt.getTarifa());
		System.out.println("Cor: "+srt.getCor());
		
	}

}
